﻿@using GMS.Framework.Contract
@using GMS.Framework.Utility
@using GMS.Framework.Web.Controls
@using GMS.Account.Contract

@model PagedList<Role>
@{
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<div class="row-fluid">
    <div class="span4">
        <div>
            <a class="btn red" id="delete" href="javascript:;"><i class="icon-trash icon-white"></i> 删除</a>
            <a class="btn blue thickbox" title='添加新角色' href="@Url.Action("Create")?TB_iframe=true&height=350&width=500"><i class="icon-plus icon-white"></i> 新增</a>
        </div>
    </div>
    <div class="span8">
        @using (Html.BeginForm(null, null, null, FormMethod.Get, new { id = "search" }))
        { 
        <div class="dataTables_filter">
            <label>
                <button type="submit" class="btn">搜索 <i class="icon-search"></i></button>
             </label>
            <label>
                <span>角色名：</span>
                @Html.TextBox("RoleName", null, new { @class = "m-wrap small" })
            </label>
        </div>
        }
    </div>
</div>

@using (Html.BeginForm("Delete", "Role", FormMethod.Post, new { id = "mainForm" }))
{
<table class="table table-striped table-hover ">
    <thead>
        <tr>
            <th style="width: 8px;">
                <input type="checkbox" id="checkall" class="group-checkable" />
            </th>
            <th>
                角色名
            </th>
            <th>
                说明
            </th>
            <th class="hidden-480">
                权限
            </th>
            <th>
                操作
            </th>
        </tr>
    </thead>
    <tbody>
        @foreach (var m in Model)
        {
        <tr>
            <td>
                <input type="checkbox" class="checkboxes" name='ids' value='@m.ID' />
            </td>
            <td>
                @m.Name
            </td>
            <td>
                @m.Info
            </td>
            <td class="hidden-480">
                @StringUtil.CutString(string.Join(",", m.BusinessPermissionList.Select(r => EnumHelper.GetEnumTitle(r))), 40)
            </td>
            <td>
                <a class="btn mini purple thickbox" title='编辑角色资料' href="@Url.Action("Edit", new { id = m.ID })?TB_iframe=true&height=350&width=500">
                    <i class="icon-edit"></i>
                    编辑及权限
                </a>
            </td>
        </tr>
        }
    </tbody>
</table>
}
<div class="dataTables_paginate paging_bootstrap pagination">
    @Html.Pager(Model, new PagerOptions() { ShowTotalItemCount = true })
</div>

